<style>
    .modal-dialog {
        width: 430px;
    }
</style>

<div>
    <form id="set_code" action="{:Url()}" method="post" class="ajax-form">
        <div class="form-group clearfix">
            <label class="col-xs-4 control-label" style="text-align: right;">
                {:lang('_INV_CODE_')}{:lang('_COLON_')}
            </label>

            <div class="col-xs-8">
                <input type="text" name="code" class="form-control" value="">
                <div class="clearfix"></div>
            </div>
        </div>
        <div style="width: 100%;text-align: center;">
            <a class="btn btn-primary" data-role="submit">{:lang('_SUBMIT_')}</a>
            <a onclick="$('.close').click();" class="btn btn-default">{:lang('_CANCEL_')}</a>
        </div>
    </form>
</div>
<script>
    $(function () {
        $('[data-role="submit"]').click(function () {
                query = $('#set_code').serialize();
                var url = $('#set_code').attr('action');
                $.post(url, query, function (msg) {
                    if (msg.code) {
                        toast.success("{:lang('_SUCCESS_INV_CODE_INPUT_')}");
                        setTimeout(function () {
                            window.location.href=msg.url;
                        }, 1500);
                    } else {
                        handleAjax(msg);
                    }
                }, 'json');
        });
    });
</script>